<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <script>
            //Model
            var message="Hello";


            //ViewModel
            window.onload=function(){
                var s1=document.getElementById("s1");
                var i1=document.getElementById("i1");

                //model绑定到view
                s1.innerHTML=message;
                i1.value=message;


                //view绑定model
                i1.oninput=function(){
                    message=i1.value;
                    s1.innerHTML=message;
                };
            };

        </script>
    </head>
    <body>
        <!--View-->
        <span id="s1"></span><br/>
        <input type="text" id="i1"/>
    </body>
</html>